package config

import (
	"flag"

	"gopkg.openfuyao.cn/cluster-api-provider-bke/utils/constant"
)

var (
	MetricsAddr           string
	EnableLeaderElection  bool
	ProbeAddr             string
	WebhookCertDir        string
	WebhookPort           int
	WebhookHost           string
	BkeClusterConcurrency int
	BkeMachineConcurrency int
	E2EMode               bool
	EnableInternalUpdate  bool
)

func ConfigurationFlag() {
	flag.BoolVar(&E2EMode, "e2e-mode", false, "Enable e2e mode")
	flag.StringVar(&MetricsAddr, "metrics-bind-address", "0", "The address the metric endpoint binds to. eg. :8080")
	flag.StringVar(&ProbeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
	flag.BoolVar(&EnableLeaderElection, "leader-elect", false,
		"Enable leader election for controller manager. "+
			"Enabling this will ensure there is only one active controller manager.")
	flag.StringVar(&WebhookCertDir, "webhook-cert-dir", "/tmp/k8s-webhook-server/serving-certs/",
		"Webhook cert dir, only used when webhook-port is specified.")
	flag.IntVar(&WebhookPort, "webhook-port", 9443, "Webhook Server port")
	flag.StringVar(&WebhookHost, "webhook-host", "", "Webhook Server host")
	flag.IntVar(&BkeClusterConcurrency, "bke-cluster-concurrency", constant.DefaultConcurrency, "Number of BKECluster to process simultaneously")
	flag.IntVar(&BkeMachineConcurrency, "bke-machine-concurrency", constant.DefaultConcurrency, "Number of BKEMachine to process simultaneously")
	flag.BoolVar(&EnableInternalUpdate, "enable-internal-update", false, "Enable internal update")
}
